package com.itheima.controller;

import com.itheima.common.R;
import com.itheima.dto.UserLoginDTO;
import com.itheima.service.LoginService;
import com.itheima.vo.UserLoginVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/index")
public class LoginController {
    @Autowired
    private LoginService loginService;

    /**
     * 用户登录
     * @param userLoginDTO
     * @return {@link R}<{@link UserLoginVO}>
     */
    @PostMapping("/login")
    public R<UserLoginVO> login(@RequestBody UserLoginDTO userLoginDTO) {
           UserLoginVO userLoginVo= loginService.login(userLoginDTO);
        return R.success(userLoginVo);
    }
}
